<template>
	<view>
		<web-view :src="src"></web-view>
	</view>
</template>

<script>
	import {
		BASE_IP
	} from '@/common/http/url.js'
	export default {
		data() {
			return {
				src: '',
			}
		},
		onLoad(options) {
			console.log(options)
			if (options.src) {
				this.src = options.src
			} else {
				this.onShares(options.arrList)
			}

		},
		methods: {
			onShares(arrList) {
				let user = uni.getStorageSync("user")
				let url = BASE_IP + "pc/record/merge/pdfs"
				uni.request({
					url: url,
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						"Authorization": user.token
					},
					method: "POST",
					data: {
						recordList: arrList,
						test: "test"
					},
					success: (res) => {
						if (res.statusCode == 200) {
							let u = BASE_IP + res.data
							console.log(111111, u)
							this.src = u
						}
						if (res.statusCode == 404) {
							uni.showToast({
								title: "请求失败",
								icon: "error"
							})
						}
						if (res.statusCode == 500) {
							uni.showToast({
								title: "请求失败",
								icon: "error"
							})
						}
					},
					fail: () => {
						uni.showToast({
							title: "请求失败",
							icon: "error"
						})
						return
					}
				})
			},
		}
	}
</script>

<style>

</style>